package com.ihr360.shared.sequence.dto;


import com.ihr360.commons.entityhandler.Ihr360ContextHandler;
import com.ihr360.shared.sequence.dto.mapped.Ihr360SequenceBase;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.util.List;

/**
 * 序列号生成器模板定义
 *
 * @author davidwei
 */
@Entity
@EntityListeners(value = {Ihr360ContextHandler.class})
@Table(name = "sc_sequence_template", uniqueConstraints = @UniqueConstraint(columnNames = {"bizModel", "companyId"}))
public class Ihr360SequenceTemplate extends Ihr360SequenceBase {
    @Column(length = 40, nullable = false)
    private String companyId;

    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn
    private List<Ihr360SequenceNo> sequenceNos;

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public List<Ihr360SequenceNo> getSequenceNos() {
        return sequenceNos;
    }

    public void setSequenceNos(List<Ihr360SequenceNo> sequenceNos) {
        this.sequenceNos = sequenceNos;
    }
}